#ifndef BITSTREAM_H
#define BITSTREAM_H
#include <stdint.h>
typedef struct bs_s
{
    uint8_t *p_start;
    uint8_t *p;
    uint8_t *p_end;

    uintptr_t cur_bits;
    int     i_left;    /* i_count number of available bits */
} bs_t;

int bs_init(bs_t *bs);
void bs_flush(bs_t *s );
void bs_write(bs_t *s, int n, uint32_t v);
void bs_write_se( bs_t *s, int val);
void bs_write_ue( bs_t *s, unsigned int val);
void bs_align_1( bs_t *s );
#endif
